# pragma once

#include <vector>
#include "IProtocol.h"
#include <boost/shared_ptr.hpp>
#include <boost/archive/text_oarchive.hpp>
#include <boost/archive/text_iarchive.hpp>

class ILayer
{
public:
	friend class boost::serialization::access;
	virtual ~ILayer(void) 
	{

	}

	template<class Archive> 
	void serialize(Archive & ar, const unsigned int version) 
	{
		ar & name;
	}

	virtual void init() = 0;
	virtual void addProtocol(const boost::shared_ptr<IProtocol>& protocol) = 0;
	virtual const boost::shared_ptr<IProtocol>& getProtocol( const std::string& name) const = 0;
	virtual void removeProtocol( const std::string& name) = 0;
	virtual const std::string& getName() const { return name; }


	virtual StackUtils::e_Status Decode(CPacket& packet) = 0;
	virtual StackUtils::e_Status Encode(CPacket& packet) = 0;

protected:
	std::string name;
};

BOOST_SERIALIZATION_ASSUME_ABSTRACT(ILayer)